#include <iostream>
#include <string>
#include <map>
#include <functional>
using namespace std;

void to_uppercase(string& s)
{
    for( auto& e : s)
    {
        if(e >= 'A' && e <='Z')
        {
            e += 32;
        }
    }
}
int main() 
{
    string s;
    map<string,int> countmap;
    while( cin>> s)
    {
        if(s.back() == '.')
            s.pop_back();
        to_uppercase(s);
        countmap[s]++;
    }
    multimap<int,string,greater<int>> sortmap;
    for(auto& e : countmap)
    {
        sortmap.insert(make_pair(e.second,e.first));
    }
    auto it = sortmap.begin();
    while(it != sortmap.end())
    {
        cout<<it->second<<":"<<it->first<<endl;
        it++;
    }
}
